/*    */ package com.qmsk.business.member.memberService.controller;
/*    */ 
/*    */ import com.qmsk.business.member.memberService.dao.MemberServiceUserDAO;
/*    */ import com.utils.gson.out.GsonEbRst;
/*    */ import com.utils.jdbc.connection.DbConnection;
/*    */ import com.utils.web.RequestUtils;
/*    */ import com.utils.web.ResponseUtils;
/*    */ import java.sql.SQLException;
/*    */ import javax.servlet.http.HttpServletRequest;
/*    */ import javax.servlet.http.HttpServletResponse;
/*    */ import org.apache.log4j.Logger;
/*    */ import org.springframework.beans.factory.annotation.Autowired;
/*    */ import org.springframework.stereotype.Controller;
/*    */ import org.springframework.transaction.annotation.Transactional;
/*    */ import org.springframework.web.bind.annotation.PathVariable;
/*    */ import org.springframework.web.bind.annotation.RequestMapping;
/*    */ 
/*    */ @Controller
/*    */ @RequestMapping({"/memberSrvUser"})
/*    */ public class MemberServiceUserController
/*    */ {
/* 26 */   private static final Logger logger = Logger.getLogger(MemberServiceUserController.class);
/*    */ 
/*    */   @Autowired
/*    */   private MemberServiceUserDAO dao;
/*    */ 
/*    */   @RequestMapping(value={"find/srvId/{srvId}/{pageIdx}/{pageSize}"}, method={org.springframework.web.bind.annotation.RequestMethod.GET})
/*    */   public void getListOfSrvId(HttpServletRequest request, HttpServletResponse response, @PathVariable("srvId") Integer srvId, @PathVariable("pageIdx") Integer nPageIdx, @PathVariable("pageSize") Short nPageSize)
/*    */   {
/* 35 */     nPageSize = RequestUtils.getRequestValidPageSize(nPageSize);
/*    */     try {
/* 37 */       GsonEbRst gsonEbRst = this.dao.getGsonOfSrvId(srvId, nPageIdx, nPageSize);
/* 38 */       ResponseUtils.setResponseResult(gsonEbRst, response);
/*    */     } catch (SQLException e) {
/* 40 */       logger.error(e);
/* 41 */       ResponseUtils.setErrorMsgResponse(
/* 42 */         RequestUtils.getFindDataErrorMessage(request), response);
/*    */     }
/*    */   }
/*    */ 
/*    */   @Transactional
/*    */   @RequestMapping(value={"insert/List"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
/*    */   public void insertList(HttpServletRequest request, HttpServletResponse response) {
/* 49 */     String sJson = RequestUtils.getString(request, "data");
/* 50 */     int nResult = -1;
/*    */     try {
/* 52 */       this.dao.deleteListPk(sJson);
/* 53 */       nResult = this.dao.insertList(sJson);
/* 54 */       DbConnection.commit();
/* 55 */       ResponseUtils.setSqlResultResponse(nResult, 
/* 56 */         RequestUtils.getSqlInsertDataErrorMessage(request), 
/* 57 */         response);
/*    */     } catch (SQLException e) {
/* 59 */       DbConnection.rollback();
/* 60 */       logger.error(e);
/* 61 */       ResponseUtils.setErrorMsgResponse(
/* 62 */         RequestUtils.getSqlInsertDataErrorMessage(request) + ":" + 
/* 63 */         e.getMessage(), response);
/*    */     }
/*    */   }
/*    */ 
/*    */   @Transactional
/*    */   @RequestMapping(value={"delete/List"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
/*    */   public void deleteList(HttpServletRequest request, HttpServletResponse response) {
/* 70 */     int nUpdates = -1;
/* 71 */     String sJson = RequestUtils.getStringOfId(request);
/*    */     try {
/* 73 */       nUpdates = this.dao.deleteList(sJson);
/* 74 */       DbConnection.commit();
/* 75 */       ResponseUtils.setSqlResultResponse(nUpdates, 
/* 76 */         RequestUtils.getSqlDeleteDataErrorMessage(request), 
/* 77 */         response);
/*    */     } catch (SQLException e) {
/* 79 */       DbConnection.rollback();
/* 80 */       logger.error(e);
/* 81 */       ResponseUtils.setErrorMsgResponse(
/* 82 */         RequestUtils.getSqlDeleteDataErrorMessage(request) + ":" + 
/* 83 */         e.getMessage(), response);
/*    */     }
/*    */   }
/*    */ }

/* Location:           C:\Users\Administrator\Desktop\新建文件夹\WEB-INF\classes\
 * Qualified Name:     com.qmsk.business.member.memberService.controller.MemberServiceUserController
 * JD-Core Version:    0.5.3
 */